package com.lottery.material.controller.admin.web;

import com.lottery.material.controller.base.BaseController;
import com.lottery.material.entity.admin.User;
import com.lottery.material.service.admin.system.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * Description：访问根路径index文件（测试项目是否能够正常运行）
 * Created by 朱正磊 on 2019-03-25 17:06
 */
@Controller
@Slf4j
public class IndexController extends BaseController {

    private final UserService userService;

    @Autowired
    public IndexController(UserService userService) {
        this.userService = userService;
    }

    /**
     * description：访问根路径
     * user 朱正磊
     * time 2019-03-25 18:06
     * @return 返回模型视图
     */
    @GetMapping(value = {"/", "/index"})
    public ModelAndView index() {
        List<User> userList = userService.findAll();
        log.info("【查询所有用户信息】userList = {}", userList);
        return new ModelAndView("index");
    }

}
